<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    /* 让行内级元素居中 */
    /* text-align可以让父元素的中的inlinelevel-box的盒子居中 */
  .box{
    background-color:#f00;
    text-align:center;
  }
  .box span{
    background-color: #00ff00;
  }
  .container{
    background-color:#00f;
    width:100px;height:100px;
    /* 如果是块级元素，要给本身设置maggin -0-auto */
    margin:0 auto;
  }
  
  
  </style>
</head>
<body>
  

  <div class="box">
    <span>我是span元素</span>
    <div class="container"></div>
  </div>
</body>
</html>